package controllers

import (
	"github.com/astaxie/beego"
)

// 这是一个测试控制器
type TestController struct {
	beego.Controller
}

// URLMapping ...
func (c *TestController) URLMapping() {
	c.Mapping("Post", c.Post)
	c.Mapping("Get", c.GetOne)
}

// Post ...
// @Title 123213
// @Description create Entities
// @Param	body		body 	models.Entities	true		"body for Entities content"
// @Success 201 {int} models.Entities
// @Failure 403 body is empty
// @router / [post]
func (c *TestController) Post() {
	c.Data["json"] = map[string]string{"123":"321"}
	c.ServeJSON()
}

// Get ...
// @Title 12312
// @Description get Entities by id
// @Param	id		path 	string	true		"The key for staticblock"
// @Success 200 {object} models.Entities
// @Failure 403 :id is empty
// @router /:id [get]
func (c *TestController) GetOne() {
	idStr := c.Ctx.Input.Param(":id")
	c.Data["json"] = map[string]string{"id":idStr}
	c.ServeJSON()
}
